﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BusinessLogic.BusinessEntity.Entities;


namespace UserInterface.ClientApplication.UIEntity
{
	[Serializable]
	public class AccountView
	{
		public int ID { get; set; }

		public ClientView Accountee { get; set; }

		public CurrencyView Currency { get; set; }

		public string Number { get; set; }

		public decimal Balance { get; set; }

		public AccountView(){}

		public AccountView(Account account)
		{
			ID = account.ID;
			Accountee = new ClientView(account.Accountee);
			Currency = new CurrencyView(account.Currency);
			Number = account.Number;
			Balance = account.Balance;
		}

		public Account ToBE()
		{
			Account result = new Account();
			result.Balance = Balance;
			result.Number = Number;
			if(Currency != null)
				result.Currency = Currency.ToBE();
			if(Accountee != null)
				result.Accountee = Accountee.ToBE();
			return result;
		}

		public override string ToString()
		{
			return Number;
		} 
	}
}
